import hashlib


def password1():
    s0 = "@DBApp"
    s = "6E32D0943418C2C33385BC35A1470250DD8923A9".lower()
    for i in range(100000, 1000000):
        pd = str(i) + s0
        res = hashlib.sha1(pd.encode("utf-8")).hexdigest()
        if res == s:
            print(f"sha1('{pd}') = {s}")
            print(f"The first password is: {str(i)}")
            break


def password2():
    s0 = list("{\\rtf1")
    s1 = [0x05, 0x7D, 0x41, 0x15, 0x26, 0x01]
    pd = ""
    for i in range(len(s0)):
        pd += chr(ord(s0[i]) ^ s1[i])
    print(f"The second password is: {pd}")


if __name__ == "__main__":
    password1()
    print()
    password2()
